import React, { Component } from "react";
import { View } from "@tarojs/components";
import { AtTabBar } from "taro-ui";
import "taro-ui/dist/style/components/tab-bar.scss";
import allIcon from "../../images/all.png";
import clockIcon from "../../images/clock.png";
import jdIcon from "../../images/jd.png";
import userIcon from "../../images/user.png";
class Bar extends Component {
  constructor(props) {
    super(props);
  }
  render() {
    let { current } = this.props;
    return (
      <AtTabBar
        color="#A1A4B0"
        fontSize={12}
        selectedColor="#03CDA3"
        className="nav-bar"
        tabList={[
          { title: "全职", image: allIcon },
          { title: "兼职", image: clockIcon },
          { title: "简历", image: jdIcon },
          { title: "我的", image: userIcon }
        ]}
        fixed
        onClick={num => {
          let url = "";
          switch (num) {
            case 0:
              url = "../index/index";
              break;
            case 1:
              url = "../time/index";
              break;
            case 2:
              url = "../jd/index";
              break;
            case 3:
              url = "../user/index";
              break;
            default:
              return null;
          }
          wx.redirectTo({
            url: url,
            success: () => {
              console.log("xxx");
            },
            fail: e => {
              console.log(e);
            }
          });
        }}
        current={current}
      />
    );
  }
}
export default Bar;
